<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
	function upload() {
		var obj = new Object();
		showModalDialog('displayupload', obj,
				'height=300,width=600,top=0,left=0,resizable');
		document.getElementById('filepath').value = obj.returnvalue;
		document.getElementById('image').setAttribute("src", "<%=request.getContextPath()%>
	" + obj.returnvalue);

	}
</script>

</head>
<body>
	<form:form action="addfood" method="post" modelAttribute="food">
Add new food<br />
Name<form:input path="name" type="text" name="name" />
		<br />
Image<img id="image" alt="" src="">
		<button type="button" onclick="upload()">Change</button>
		<form:input id="filepath" path="image" type="hidden" name="image" />
		<br />
Type<form:input path="type" type="text" name="type" />
		<br />
Source<form:input path="source" type="text" name="source" />
		<br />
Wholesale Price<form:input path="wholesalePrice" type="text"
			name="wholesalePrice" />
		<br />
Retail Price<form:input path="retailPrice" type="text"
			name="retailPrice" />
		<br />
Status<form:input path="status" type="text" name="status" />
		<br />
Information<form:textarea path="info" name="info" rows="5"
			style="width: auto;"></form:textarea>
		<br />
		<button type="submit">Save</button>
	</form:form>

</body>
</html>